<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/bluetooth/resources/bluetooth-test.js"></script>
<script src="/bluetooth/resources/bluetooth-fake-devices.js"></script>
<script>
'use strict';
const test_desc = 'A device namePrefix of 248 bytes is valid.';
const DEVICE_NAME = 'a'.repeat(248);

bluetooth_test(
    () => setUpPreconnectedDevice({name: DEVICE_NAME})
              .then(
                  () => requestDeviceWithTrustedClick(
                      {filters: [{namePrefix: DEVICE_NAME}]}))
              .then(device => assert_equals(device.name, DEVICE_NAME)),
    test_desc);
</script>
